﻿using HZU.ZP.Data.Interfaces.Resume;
using HZU.ZP.Domain.IService.Resume;
using HZU.ZP.Domain.Model.Resume;
using HZU.ZP.Domain.ServiceImpl.Mappers.Resume;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc.Resume
{
    public class AwardService:IAwardService
    {
        private AwardMapper _mapper = new AwardMapper();
        private IAwardDao _sqlData;
        public AwardService(IAwardDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool AddAward(Award award)
        {
            var awardDao = _mapper.MapToDao(award);
            _sqlData.AddAward(awardDao);
            return true;
        }

        public bool DeleteAward(int id)
        {
            _sqlData.DeleteAward(id);
            return true;
        }

        public IList<Award> GetAwardList(int applicanId)
        {
            return _mapper.MapToDomainList(_sqlData.GetAwardList(applicanId));
        }

        public bool UpdateAward(Award award)
        {
            var awardDao = _mapper.MapToDao(award);
            _sqlData.UpdateAward(awardDao);
            return true;
        }
    }
}
